<template>
  <div>
    <div>欢迎光临我的水果店，我的上帝</div>
    <div>
      <p>苹果是10￥一斤哦，鉴于您的帅气可以打8折</p>
      您要买多少斤呢 <input type="number" v-model="count">
    </div>
    <button @click="getTotal">点点我</button>
    <div>这是您的账单：总价：{{total}}￥ 折后价：{{pretotal}}￥ 为您节省了{{total - pretotal}}￥ </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      count: null,
      total: 0,
      pretotal: 0
    }
  },
  methods: {
    getTotal(){
      this.total = this.count * 10
      this.pretotal = this.total * 0.8
    }
  }
}
</script>

<style>

</style>